#-------------------------------------------------------------------------------
# Trim the passed in value (and assigned if applicable)
#
function trim() {
    local _var=$1
    local _assigned=$2
    
    # remove leading whitespace characters
    _var="${_var#"${_var%%[![:space:]]*}"}"
    # remove trailing whitespace characters
    _var="${_var%"${_var##*[![:space:]]}"}"
    
    # assignment or just do an echo of the result
    if [[ "$_assigned" ]]; then
        eval $_assigned="$_var"
    else
        echo -n "$_var"
    fi
}

#-------------------------------------------------------------------------------
# System Information
#
function get_systeminfo() {
    local _NIC=$(ip addr show |grep -w inet |grep -v 127.0.0.1|awk '{ print $7}')
    local _hostname=$(hostname -a)
    local _domain=$(hostname -d)
    
    echo "Network"
    echo "-----------------------------------"
    echo "Hostname: $_hostname"
    echo "Domain: $_domain"
    for nic in $_NIC
    do
        local _IP=$(ifconfig $nic |grep -w inet |grep -v 127.0.0.1|awk '{ print $2}'| cut -d "/" -f 1)
        echo "Device: $nic"
        echo "- $_IP"
    done
    
    return 0
}

get_systeminfo